"use strict";
cc._RF.push(module, '2b9a6qxXG5DDpP6bSbadlZE', 'ShotGunBullet');
// scripts/ShotGunBullet.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GameConstant"),
    s = t("Util"),
    l = t("Global"),
    c = cc._decorator,
    d = c.ccclass,
    h = c.property,
    p = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.collider = null, e.par_fire = null, e.bullet = null, e._speed = 0, e._gravity = 0, e.degree = 0, e.curPos = null, e.nextPos = null, e.isAction = !1, e.destroyBullet = function () {
      var t = this;
      this.bullet.active = !1, this.isAction = !1, this.par_fire.resetSystem(), this.scheduleOnce(function () {
        s.Util.objectPool.putNodeIntoNodePool(l.PoolKey.ShotGun, t.node);
      }, 1);
    }, e;
  }

  return n(e, t), e.prototype.init = function (t, e, o, i, n, a) {
    this.node.position = i, this._gravity = 0, this._speed = a, this.setScale(e == r.Collide_Car_Tag.Right, o), this.curPos = this.node.position, this.collider.enabled = !0, this.collider.tag = t, this.bullet.active = !0, this.node.angle = n, this.degree = this.node.angle / 180 * Math.PI, this.isAction = !0, this.scheduleOnce(this.destroyBullet, .5);
  }, e.prototype.setScale = function (t, e) {
    var o = 1;
    o = r.Cur_Game_Type == r.Game_Type.PK ? r.Game_Type_Scale.PK : 1, o = e < 0 ? -o : o, this.node.scale = t ? -o : o;
  }, e.prototype.update = function () {
    if (this.isAction) {
      var t = cc.Vec2.ZERO,
          e = cc.v2(this.node.x, this.node.y);
      this.node.scaleX >= 0 ? (e.x += this._speed * Math.cos(this.degree), e.y += this._speed * Math.sin(this.degree)) : (e.x -= this._speed * Math.cos(this.degree), e.y -= this._speed * Math.sin(this.degree)), cc.Vec2.lerp(t, this.node.getPosition(), e, .2), this.node.setPosition(t);
    }
  }, e.prototype.removeItem = function () {
    this.collider.enabled = !1, this.unschedule(this.destroyBullet), this.destroyBullet();
  }, a([h(cc.Collider)], e.prototype, "collider", void 0), a([h(cc.ParticleSystem)], e.prototype, "par_fire", void 0), a([h(cc.Node)], e.prototype, "bullet", void 0), a([d], e);
}(cc.Component);

o["default"] = p;

cc._RF.pop();